// 卖家模型
const { DataTypes } = require('sequelize');
const { sequelize } = require('../utils/sequelize');
const config = require('../config/database');

const Seller = sequelize.define(
  'BidSeller', // 模型名称
  {
    id: {
      type: DataTypes.STRING(50),
      primaryKey: true,
      allowNull: false,
      comment: '卖家ID'
    },
    user_id: {
      type: DataTypes.STRING(50),
      allowNull: false,
      comment: '用户ID'
    },
    name: {
      type: DataTypes.STRING(50),
      allowNull: false,
      comment: '卖家名称'
    },
    description: {
      type: DataTypes.STRING(255),
      allowNull: true,
      comment: '卖家描述'
    },
    avatar: {
      type: DataTypes.STRING(255),
      allowNull: true,
      comment: '卖家头像'
    },
    rating: {
      type: DataTypes.INTEGER,
      allowNull: true,
      comment: '卖家评分'
    },
    real_name_auth: {
      type: DataTypes.BOOLEAN,
      allowNull: true,
      comment: '是否实名认证'
    },
    phone_auth: {
      type: DataTypes.BOOLEAN,
      allowNull: true,
      comment: '是否手机认证'
    },
    status: {
      type: DataTypes.STRING(20),
      allowNull: true,
      comment: '卖家在线状态'
    },
    goods_count: {
      type: DataTypes.INTEGER,
      allowNull: true,
      comment: '商品数量'
    },
    transaction_count: {
      type: DataTypes.INTEGER,
      allowNull: true,
      comment: '交易数量'
    },
    reply_rate: {
      type: DataTypes.STRING(20),
      allowNull: true,
      comment: '回复率'
    }
  },
  {
    tableName: config.mysql.prefix + 'sellers',
    timestamps: true,
    createdAt: 'created_at',
    updatedAt: 'updated_at'
  }
);

module.exports = Seller;